/*
 * FacadeAutenticazione
 * 
 * This class implements IFacadeAutenticazione
 * 
 * Author: Carmine Colicino, Luigi Di Martino
 * Version: 1.0
 * 
 * 2014 - Copyright by Team 6 - University of Salerno
*/

package it.unisa.udocs.facade;

import java.sql.SQLException;
import java.util.ArrayList;

import it.unisa.udocs.data.Account;
import it.unisa.udocs.storage.DBAccount;
import it.unisa.udocs.storage.DBProdotto;

public class FacadeAutenticazione implements IFacadeAutenticazione {
	
	/**
	 * Is used to search for an Account in our System
	 * 
	 * @param  username - The username
	 * @param  password - The password
	 *  @return The account found in the System
	 * 
	 */
	public Account cercaAccount(String username, String password) throws SQLException {
		
		Account account = DBAccount.getInstance().cercaAccount(username, password);
		
		return account;
	}

	/**
	 * Is used to search for  all researchers in our System
	 * 
	 * @return The list of all researchers stored in the System 
	 * 
	 */
	public ArrayList<Account> getAllRicercatori() throws SQLException {
		// TODO Auto-generated method stub
		return DBAccount.getInstance().getAllRicercatori();
		
	}
	
	/**
	 * 
	 * Is used to check if an account exists or not in our System
	 * 
	 * @param Account - The Account 
	 * 
	 * @return 0 if The Account doesn't exist, 1 if the account exists
	 * 
	 */
	public int isAnAccount(Account acc) {
		return DBAccount.getInstance().notAnAccount(acc);
	}
	
}
